﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AgilePlannerDT.Application.Commands.Impl
{
    public class ApCommandImpl : ApCommand
    {
        protected AgilePlannerApplication app;
        protected bool isUndone = false;
        protected DateTime lastExecuted;
        protected long id;

        public ApCommandImpl(AgilePlannerApplication app)
        {
            this.app = app;
            this.lastExecuted = DateTime.Now;
        }

        #region ApCommand Members

        public virtual void Undo()
        {
            lastExecuted = DateTime.Now;
            isUndone = true;
        }

        public virtual void Redo()
        {
            lastExecuted = DateTime.Now;
            isUndone = false;
        }

        public bool IsUndone
        {
            get { return this.isUndone; }
            set { this.isUndone = value; }
        }

        public DateTime LastExecuted
        {
            get { return this.lastExecuted; }
            set { this.lastExecuted = value; }
        }

        public long ID
        {
            get { return this.id; }
        }


        #endregion

        #region IComparable<ApCommand> Members

        public int CompareTo(ApCommand other)
        {
            return lastExecuted.CompareTo(other.LastExecuted);
        }

        #endregion
    }
}
